FUNCTION

list.add

function add(index: integer, value: T): boolean

Insert a value at the specified index. Any elements previously occurring at and after the specified index have their indices increased by 1, and the size of the list increases by 1.

Note that for a list my_list:

  • my_list.add(my_list.size(), x) "appends" x to the end of the list
  • my_list.add(my_list.size() + 1, x) throws an exception

Note also that my_list.add(my_list.size(), x) is equivalent to my_list.add(x) (inherited from collection<T>).

Parameters

  • index — The index at which to add the element.
  • value — The value to add.

Returns

true

Throws

  • exception — if the index is out of bounds

Since

0.6.0


function add(value: T): boolean

Append an element to the end of this collection.

The element is not added if this collection does not allow duplicates and the element is already contained in this collection.

Parameters

  • value — the element to add

Returns

true if the element was added, false otherwise

Since

0.6.0

© 2026 Chromia